package com.whu.bookstore.entity;

import java.util.Arrays;

/**
 * Created by chenshaojie on 2018/5/18,12:54.
 */
public class User {

    private String name;
    private String password;
    private int id;
    private byte[] portrait;
    private int remaining;

    public String getName () {
        return name;
    }

    public void setName (String name) {
        this.name = name;
    }

    public String getPassword () {
        return password;
    }

    public void setPassword (String password) {
        this.password = password;
    }

    public int getId () {
        return id;
    }

    public void setId (int id) {
        this.id = id;
    }

    public byte[] getPortrait () {
        return portrait;
    }

    public void setPortrait (byte[] portrait) {
        this.portrait = portrait;
    }

    public int getRemaining () {
        return remaining;
    }

    public void setRemaining (int remaining) {
        this.remaining = remaining;
    }

    @Override
    public boolean equals (Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        User user = (User) o;

        if (id != user.id) return false;
        if (remaining != user.remaining) return false;
        if (name != null ? !name.equals(user.name) : user.name != null) return false;
        if (password != null ? !password.equals(user.password) : user.password != null) return false;
        if (!Arrays.equals(portrait, user.portrait)) return false;

        return true;
    }

    @Override
    public int hashCode () {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (password != null ? password.hashCode() : 0);
        result = 31 * result + id;
        result = 31 * result + Arrays.hashCode(portrait);
        result = 31 * result + remaining;
        return result;
    }
}
